From: Keir Fraser Date: Tue, 4 May 2010 21:43:30 +0000 (+0100) Subject: scheduler: Add a global parameter adjustment to the switchable scheduler interface X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12260 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=559a9ec5800922288bac571d0beb9e4240fe7e1d;p=xen.git scheduler: Add a global parameter adjustment to the switchable scheduler interface ...along with a new sysctl to call it directly. This is in order to support DornerWorks' new ARINC653 scheduler. Based on code from Josh Holtrop and Kathy Hadley at DornerWorks, Ltd Signed-off-by: George Dunlap Signed-off-by: Keir Fraser --- diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 52ca2b8944..ebc9703dbc 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -882,6 +882,21 @@ long sched_adjust(struct domain *d, struct xen_domctl_scheduler_op *op) return ret; } +long sched_adjust_global(struct xen_sysctl_scheduler_op *op) +{ + const struct scheduler *sched; + + sched = scheduler_get_by_id(op->sched_id); + if ( sched == NULL ) + return -ESRCH; + + if ( (op->cmd != XEN_DOMCTL_SCHEDOP_putinfo) && + (op->cmd != XEN_DOMCTL_SCHEDOP_getinfo) ) + return -EINVAL; + + return SCHED_OP(sched, adjust_global, op); +} + static void vcpu_periodic_timer_work(struct vcpu *v) { s_time_t now = NOW(); diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index 51b0a8e414..5365c20f29 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -326,6 +326,14 @@ long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) } break; + case XEN_SYSCTL_scheduler_op: + { + ret = sched_adjust_global(&op->u.scheduler_op); + if ( (ret == 0) && copy_to_guest(u_sysctl, op, 1) ) + ret = -EFAULT; + } + break; + default: ret = arch_do_sysctl(op, u_sysctl); break; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 7d8d9294b8..1241fd71d9 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -536,6 +536,19 @@ struct xen_sysctl_cpupool_op { typedef struct xen_sysctl_cpupool_op xen_sysctl_cpupool_op_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpupool_op_t); +#define XEN_SYSCTL_scheduler_op 19 +/* Set or get info? */ +#define XEN_SYSCTL_SCHEDOP_putinfo 0 +#define XEN_SYSCTL_SCHEDOP_getinfo 1 +struct xen_sysctl_scheduler_op { + uint32_t sched_id; /* XEN_SCHEDULER_* (domctl.h) */ + uint32_t cmd; /* XEN_SYSCTL_SCHEDOP_* */ + union { + } u; +}; +typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_scheduler_op_t); + struct xen_sysctl { uint32_t cmd; uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ @@ -557,6 +570,7 @@ struct xen_sysctl { struct xen_sysctl_page_offline_op page_offline; struct xen_sysctl_lockprof_op lockprof_op; struct xen_sysctl_cpupool_op cpupool_op; + struct xen_sysctl_scheduler_op scheduler_op; uint8_t pad[128]; } u; }; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 71ead96c8e..6da6b2d0f9 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -469,6 +469,7 @@ int sched_init_domain(struct domain *d); void sched_destroy_domain(struct domain *d); int sched_move_domain(struct domain *d, struct cpupool *c); long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *); +long sched_adjust_global(struct xen_sysctl_scheduler_op *); int sched_id(void); void sched_tick_suspend(void); void sched_tick_resume(void);